Convolutional Neural Networks (CNNs) have been successfully used to classify dynasties of ancient murals from Dunhuang. Aiming at the problem that using some data enhancement methods to expand the training set would reduce the prediction accuracy due to the limited amount of data of Dunhuang murals, a Residual Network (ResNet) model based on attention mechanism and transfer learning was proposed. Firstly, the residual connection method of the residual network was improved. Then, the POlarized Self-Attention (POSA) module was used to help the network model to extract the edge local detail features and global contour features of the images, and the learning ability of the network model in a small sample environment was enhanced. Finally, the algorithm for classifier was improved, so that the classification performance of the network model was improved. Experimental results show that the proposed model achieves 98.05% accuracy of dynastic classification on DH1926 small sample dataset of Dunhuang murals, and the dynasty identification accuracy of the proposed model is improved by 5.21 percentage points compared with that of the standard ResNet20 network model.